寻求C语言达人`帮我做些题`谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/15 04:42:35
题目一:猜数游戏,要求猜一个介于1-10之间的数字,根据用户猜测的数字与标准值进行对比,并给出提示,以便下次猜测能接近标准值,直到猜中为止。
题目二:求自然1—10的平方根的立方。
题目三:输入四个数,要求按大小顺序输出。
题目四:编写程序,输入一个学生的生日(年:y0,月m0,日d0);并输入当前的日期(年y1,月m1,日d1);输出该学生的实际年龄。

题目一:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(void)
{
int number,rnd;
srand((unsigned)time(NULL));
rnd=rand()%10+1;
printf("input a number from 1 to 10\n");
in:scanf("%d",&number);
if(number>=10||number<=1)
{
printf("please input over again");
goto in;
}
if((number-rnd)!=0)
{
if((number-rnd)>0)
{
printf("the number is bigger than the answer\n try over again\n");
goto in;
}
else if((number-rnd)<0)
{
printf("the number is smaller than the answer\n try over again\n");
goto in;
}
}
else
{
printf("Congratulation!